import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:largefriends/res/lf_double_ext.dart';

import '../../../res.dart';
import '../../../res/lf_fonts.dart';
import '../../../res/lf_text_style.dart';
import '../../../res/strings/lf_strings.dart';
import '../../../service/lf_auth_service.dart';
import '../../lf_verify/lf_verify_logic.dart';

class LfMessageVerify extends StatefulWidget {
  const LfMessageVerify({Key? key}) : super(key: key);

  @override
  State<LfMessageVerify> createState() => _LfMessageVerifyState();
}

class _LfMessageVerifyState extends State<LfMessageVerify> {
  LfAuthService authService = Get.find();
  bool canJump = false;
  String actionTip = "";
  @override
  void initState() {
    if (authService.currentAccount!.verified == 0) {
      canJump = true;
      actionTip = strVerifyNow.tr.toUpperCase();
    } else if (authService.currentAccount!.verified == 1) {
      canJump = false;
      actionTip = strVerified.tr.toUpperCase();
    } else if (authService.currentAccount!.verified == 2) {
      canJump = false;
      actionTip = strVerifyPending.tr.toUpperCase();
    } else if (authService.currentAccount!.verified == 3) {
      canJump = true;
      actionTip = strVerifyAgain.tr.toUpperCase();
    }
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        margin: EdgeInsets.symmetric(horizontal: 10.w),
        padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 10.w),
        decoration: BoxDecoration(
            borderRadius: 14.r.radius,
            gradient: const LinearGradient(colors: [
              Color(0xFFD33F50),
              Color(0xFFB882FF),
            ], begin: Alignment(-0.9, -0.9), end: Alignment(0.9, 0.8))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Image.asset(Res.ic_verify_notification),
            15.w.sbh,
            Text(
              strAuthenticationPhotoTip.tr,
              style: lfTextStyle(
                sp: 15.sp,
                color: Colors.white,
                fontFamily: fontMedium,
              ),
              textAlign: TextAlign.center,
            ),
            15.w.sbh,
            Text(
              actionTip,
              style: lfTextStyle(
                  sp: 15.sp,
                  color: Colors.white,
                  fontFamily: fontBold,
                  decoration: TextDecoration.underline),
              textAlign: TextAlign.center,
            ),
          ],
        ),
      ),
      onTap: () {
        if (canJump) {
          Get.back();
          toVerifyPage();
        }
      },
    );
  }
}
